import {Switch,Route, Link} from 'react-router-dom'
import './css/box.css'
import Bg from './bg'
import Kh from './kh'
import Sy from './sy'
import Gl from './gl'
import Grxx from './grxx'
 
 let Box = function(){
    var sss = false
    var tx = JSON.parse(localStorage.login)
    // console.log(tx.userInfo.thumb_img);
    if (tx.userInfo.thumb_img==='') {
        tx.userInfo.thumb_img='https://ss3.bdstatic.com/70cFv8Sh_Q1YnxGkpoWK1HF6hhy/it/u=3935552106,710264437&fm=26&gp=0.jpg'
    }
    function b(){
        if (sss === false) {
            sss=true
        }else{
            sss=false
        }
        // console.log(sss);
        var zh = document.querySelector('.zh')
        if (sss) {
            zh.style.display = 'block'
        }else{
            zh.style.display = 'none'
        }
        
    }
    function c(){
        var zh = document.querySelector('.zh')
        zh.style.display = 'none'
    }
     return(
         <div className="nav">
             <ul className = 'clearfix'>
                <img alt='000' src='http://crm.cimns.com/static/img/logo.3e34073.png' />
                <Link to='/App/'><li><span className='iconfont'>&#xe625;</span>办公</li></Link>
                <Link to='/App/box/kh'><li><span className='iconfont'>&#xe68e;</span>客户管理</li></Link>
                <Link to='/App/box/sy'><li><span className='iconfont'>&#xe673;</span>商业智能</li></Link>
                <Link to='/App/box/gl'><li><span className='iconfont'>&#xe628;</span>项目管理</li></Link>

                
                <div style={{position:'absolute',top:'0',right:'20px'}}>
                    <p style={{
                        padding:'5px 15px',
                        fontSize:'12px',
                        borderRadius:'50px',
                        background:'rgb(217, 172, 124)',
                        marginTop:'20px',
                        float:'left',
                        color:'#fff'
                    }}>
                        开通授权
                    </p>
                    <div style={{float:'left',
                        marginTop:'18px',
                        marginLeft:'20px',
                        position:'relative',
                        cursor:' pointer'
                    }}>
                        <img onClick={()=>{b()}} src={tx.userInfo.thumb_img} style={{
                            width:'32px',
                            height:'32px'
                        }}/>
                        
                        <span onClick={()=>{b()}} style={{
                            marginLeft:'10px',
                            lineHeight:'32px'
                        }}>
                            ▼
                        </span>
                        <div className='zh' style={{
                            width:'180px',
                            height:'160px',
                            padding:'10px',
                            background:'#fff',
                            position:'absolute',
                            right:'-20px',
                            top:'55px',
                            zIndex:'9999999',
                        }}>
                            <p onClick={()=>{c()}}><Link to='/App/box/grxx'><span className='iconfont'>&#xe695;</span>个人中心</Link></p>
                            <p><span className='iconfont'>&#xe601;</span>退出登录</p>
                            <p><span className='iconfont'>&#xe66c;</span>版本 V9.3.2.191220</p>
                            <p className='p2'>
                                <button style={{border:'none'}}>进入企业管理后台</button>
                            </p>
                        </div>
                    </div>
                    
                </div>
            </ul>
             <div className = 'box'>
            
           
                <Switch>
                    <Route path="/App/box/grxx" component={Grxx}/>
                    <Route path="/App/box/kh" component={Kh}/>
                    <Route path="/App/box/sy" component={Sy}/>
                    <Route path="/App/box/gl" component={Gl}/>
                    <Route path="/App/" component={Bg}/>
                </Switch>
           
            
            </div>
        </div>
        
        
     )
 }
 export default Box